package com.kly.sc.api.application.controller.discount;


import com.kly.sc.api.application.controller.discount.request.TriggerDiscountRequest;
import com.kly.sc.api.application.controller.discount.response.DiscountInfoResponse;
import com.kly.sc.api.application.controller.discount.response.DiscountResponse;
import com.kly.sc.api.application.helper.RequestLocalInfo;
import com.kly.sc.api.application.service.trade.ProductDiscountService;
import com.kly.sc.api.application.utils.Result;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/api/product/discount")
@Api(value = "/api/product/discount", tags = "商品促销")
public class ProductDiscountController {

    @Resource
    private ProductDiscountService productDiscountService;

    @PostMapping("/triggerDiscount")
    @ApiOperation(value = "触发促销", notes = "触发促销")
    public Result<Integer> triggerDiscount(@RequestBody TriggerDiscountRequest triggerDiscountRequest) {
        return productDiscountService.triggerDiscount(triggerDiscountRequest);
    }

    @GetMapping("/getDiscount")
    @ApiOperation(value = "读取促销商品", notes = "读取奖励")
    public Result<DiscountResponse> getDiscount() {
        return productDiscountService.getDiscount();
    }

}
